-
-
Notifications
You must be signed in to change notification settings - Fork 745
HCaptcha support. #5953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
HCaptcha support. #5953
Conversation
| HCaptchaConfig.builder() | ||
| .siteKey("f1f21d64-6384-4114-b7d0-d9d23e203b4a") | ||
| .theme(if (WikipediaApp.instance.currentTheme.isDark) HCaptchaTheme.DARK else HCaptchaTheme.LIGHT) | ||
| .host("meta.wikimedia.org") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can leave this line unset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The WebView popped up by the hCaptcha SDK requires a base URL that matches our content-security-policy, otherwise the iframe inside the WebView will refuse to load the hcaptcha content.
| .endpoint("https://hcaptcha.wikimedia.org") | ||
| .assethost("https://assets-hcaptcha.wikimedia.org") | ||
| .imghost("https://imgs-hcaptcha.wikimedia.org") | ||
| .reportapi("https://report-hcaptcha.wikimedia.org") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(todo: all the above parameters will be served up via our new remote configuration endpoint)
| private var hCaptcha: HCaptcha? = null | ||
| private var tokenResponse: HCaptchaTokenResponse? = null | ||
|
|
||
| private val configDefault get() = RemoteConfig.RemoteConfigHCaptcha( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: even though these parameters are served by our remote configuration, we still want to hardcode some defaults here, in case the network call to fetch remote configuration fails.
cooltey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could not be able to test this because of the error code sitekey-mismatch
| imgHost = "https://imgs-hcaptcha.wikimedia.org", | ||
| reportApi = "https://report-hcaptcha.wikimedia.org", | ||
| sentry = false, | ||
| siteKey = "e11698d6-51ca-4980-875c-72309c6678cc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm curious, looking into this with the other team...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fixed now on the backend.

https://phabricator.wikimedia.org/T379190